from django.db import models

# Create your models here.

#会员模型
class Users(models.Model):
    #用户名 密码 手机号 邮箱 性别 年龄 头像 注册时间 状态
    username = models.CharField(max_length=50)
    password = models.CharField(max_length=77)
    phone = models.CharField(max_length=11)
    email = models.CharField(max_length=100,null=True)
    sex = models.CharField(max_length=1,choices=((1,'男'),(0,'女')),null=True)
    age = models.IntegerField(null=True)
    pic_url = models.CharField(max_length=100)
    #0正常 1禁用
    status = models.IntegerField(default=0)
    addtime = models.DateTimeField(auto_now_add=True)


#商品分类模型
class Cates(models.Model):
    #id name pid path
    name = models.CharField(max_length=50)
    pid = models.IntegerField()
    path = models.CharField(max_length=20)
    # isDelete = models.BooleanField(default=False)


#商品模型
class Goods(models.Model):
    title = models.CharField(max_length=255)
    cateid = models.ForeignKey(to="Cates")
    price = models.FloatField()
    store = models.IntegerField()
    info = models.TextField()
    pic_url = models.CharField(max_length=100)

    #0新发布 1热卖 2下架
    status = models.IntegerField(default=0)
    clicknum = models.IntegerField(default=0)
    ordernum = models.IntegerField(default=0)
    addtime = models.DateTimeField(auto_now_add=True)
    